-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #31 #32
Fix issue #31 #32
Conversation
// Grouping in abbreviation is valid only if preceeded/succeeded with one of the symbols for nesting, sibling, repeater or climb up | ||
if (!/\(.*\)[>\+\*\^]/.test(abbreviation) && !/[>\+\*\^]\(.*\)/.test(abbreviation) && /\(/.test(abbreviation) && /\)/.test(abbreviation)) { | ||
// Grouping in abbreviation is valid only if it's inside a text node or preceeded/succeeded with one of the symbols for nesting, sibling, repeater or climb up | ||
if ((/\(/.test(abbreviation) || /\)/.test(abbreviation)) && !/\{[^\}\{]*[\(\)]+[^\}\{]*\}(?:[>\+\*\^]|$)/.test(abbreviation) && !/\(.*\)[>\+\*\^]/.test(abbreviation) && !/[>\+\*\^]\(.*\)/.test(abbreviation)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not obvious then the (?:[>\+\*\^]|$)
part is to invalidate abbreviations like div{ a }( b ){ c }
.
I tried |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
In the cases when you can't tell, we can be more liberal than emmet in accepting inputs (as long as it can expand). |
Sorry for the mess & spam here's a summarised answer:
Action point:
|
Yesss exactly. But now the problem is unbalanced parenthesis do expand theoretically but |
Co-Authored-By: Pine <octref@users.noreply.github.com>
Sounds good. You can send a PR to https://github.com/emmetio/extract-abbreviation#readme. Thanks a lot for looking into this! |
Yeah I'm looking into fixing it, once I fix it I'll send a PR till the time I would also file an issue there. Also the pleasure is all mine! :D |
Hi @octref so now emmet PR #571, #569 that were responsible for fixing the extraction are merged. I tried to migrate from Also I went through almost all issues on vscode repo that were labelled as emmet and a lot of them can be just fixed by updating to v2 since @sergeche has fixed a bunch of issues of Also I was kinda verifying if the newer version fixes some issues and it does here's the StackBlitz that demonstrates it. Afaict #63703, #80923, #59951, #71002 and probably more can be closed with the newer emmet. So I guess it will be worth migrating to the newer emmet, and also the older one's are deprecated so vscode will have to migrate to newer one at some point to take advantage of further developments Also let me know if I should create an issue for migration instead of having all this written here. |
@devanshj Wow, thanks a lot for looking into this. Good work 👍 Moving to emmet v2 makes sense. It just involves a lot of effort. I remember the reason we had To start, I'd create an issue in vscode repo and link to all issues that would be fixed by upgrading to v2. I'll try to get some time in Oct/Nov to help you with it. |
@octref Thanks and welcome! 😁 And yeah I'll be down with helping with this as much as I can. |
Thanks to both of you. Is this still moving forward? |
You're welcome!
PR #33 was ready to merge until I realised that it doesn't have full test coverage so I had to dig deeper that's when I found out it's a whole mess. I started rewriting it, even remodeling and that's when I realized we don't need this package seperately because it's not doing much. That's when I started patching the extension itself to not use this module (ie (You can see description of PR #33 on why I'm ditching this module) So to answer your question, it's stagnant at the moment but I will work on migrating to |
Fixes #31
Fixes microsoft/vscode #77776
The RegEx/\{[^\}]*\(.*\)[^\{]*\}/
looks good to me...Heh nope, doesn't allowdiv { a (b c }
and evendiv { a ((( }
. One fix could be to use/\{[^\}\{]*\}/
but that would allow things likediv { a }(b){ c}
also...So till I figure out a good way to fix this, consider this PR as a draft.Okay so with the second commit the fix looks good to me. I have also added a bunch of tests. It did involve a little trial-and-error but I guess the tests are covering enough cases.
Also there was a minor mistake where the condition does a
/\(/.test(abbreviation) && /\)/.test(abbreviation)
to check if it has parentheses but it should be||
instead./cc @ramya-rao-a @octref